<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" placeholder="请输入照片数量">
<input type="button" value="田" onclick="f(1)">
<input type="button" value="杰" onclick="f(2)">
<input type="button" value="牙" onclick="f(3)">
<input type="button" value="雨" onclick="f(4)">
<script>
    let i = document.querySelector("input");
    function f(x) {
        if(isNaN(i.value)){
            return;
        }
        let url;
        for (let j = 0; j < i.value; j++) {
            switch (x){
                case 1: url = "c.jpg" ;
                    break;
                case 2: url = "d.jpg";
                    break;
                case 3: url = "e.jpg";
                    break;
                case 4: url = "f.jpg";
            }
            let img = document.createElement("img");
            img.src = url;
            document.body.append(img);
        }
    }
</script>
</body>
</html>